package com.example.springbootstartermqttprovider.utils;

import cn.hutool.http.HttpRequest;
import cn.hutool.json.JSONObject;


import java.io.IOException;

public class PingXianUtils {
    public static void main(String[] args) throws IOException {
        String body = HttpRequest.get("https://www.pxcxhjzhzlzx.cn/api/upmsApi/oauth/userinfo")
                .header("Authorization", "Bearer eyJraWQiOm51bGwsImFsZyI6IlJTMjU2In0.eyJpc3MiOiIke3RvcHJkLmlzc3VlckJhc2UudXJsfS91b21zcC11cG1zIiwic3ViIjoiMTAwMDAwMDAwMDAwMDAwMDAwMSIsImF1ZCI6ImJhOGNlMTNkMzc2YjkzOGRiOTQ4YTcwMmJiNmExNjFhIiwiZXhwIjoxNzQ1NDAwNTY1LCJpYXQiOjE3NDUzOTMzNjUsInVzZXJuYW1lIjoiYWRtaW4ifQ.iFXfD8V6oVXZH3ej_M1H9hjrwMcMTYMRzVWEdN91QvYEcoUeI7kToVZ8pkIpUl2_ZbdXr_OAIGed1IQ6tUCdPaNEk7qwFGmTXi5FW1TG0gSuEkp1Hj7iAoeSiKYZ8tn1e-jB63S4mznzRA8NoXZMwfkFgt38zgwRx5IW80fjeehv2NVfH-v7yHlhyGF2pXX5Vp_wVV1A6GmjritWJdVVeU1bBAsBJ6qND72DulvjVwdqfa4gCk1PM9UpmMWRCJKKQpywuWYqKGRLwrLR7YKeYo2lgczN0bD0XqMG-EZ04hHh08IEaib4uCqx4bsgqDAf4E_gnQn_hU8B7ZbgA6StPA")
                .execute().body();
        JSONObject jsonObject = new JSONObject(body);
        Boolean isSuccess;
        if("200".equals(String.valueOf(jsonObject.get("code")))){
            JSONObject data = jsonObject.getJSONObject("data");
            String email = (String) data.get("email");
            System.out.println(email);
        }
        System.out.println(jsonObject.get("data"));
        System.out.println(jsonObject.get("code"));

    }
}
